import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const addShop = r => require.ensure([], () => r(require('@/page/addShop')), 'addShop');
const addGoods = r => require.ensure([], () => r(require('@/page/addGoods')), 'addGoods');
const userList = r => require.ensure([], () => r(require('@/page/userList')), 'userList');
const shopList = r => require.ensure([], () => r(require('@/page/shopList')), 'shopList');
const foodList = r => require.ensure([], () => r(require('@/page/foodList')), 'foodList');
const orderList = r => require.ensure([], () => r(require('@/page/orderList')), 'orderList');
const adminList = r => require.ensure([], () => r(require('@/page/adminList')), 'adminList');
const visitor = r => require.ensure([], () => r(require('@/page/visitor')), 'visitor');
const newMember = r => require.ensure([], () => r(require('@/page/newMember')), 'newMember');
const uploadImg = r => require.ensure([], () => r(require('@/page/uploadImg')), 'uploadImg');
const vueEdit = r => require.ensure([], () => r(require('@/page/vueEdit')), 'vueEdit');
const adminSet = r => require.ensure([], () => r(require('@/page/adminSet')), 'adminSet');
const sendMessage = r => require.ensure([], () => r(require('@/page/sendMessage')), 'sendMessage');
const explain = r => require.ensure([], () => r(require('@/page/explain')), 'explain');
const post = r => require.ensure([], () => r(require('@/page/post')), 'post');
const train = r => require.ensure([], () => r(require('@/page/train')), 'train');
const dialog = r => require.ensure([], () => r(require('@/page/dialog')), 'dailog');
const trainReport = r => require.ensure([], () => r(require('@/page/TrainReport')), 'trainReport');
const trainDetail = r => require.ensure([], () => r(require('@/page/TrainDetails')), 'trainDetail');
const addTrains = r => require.ensure([], () => r(require('@/page/addTrains')), 'addTrains');
const personnel = r => require.ensure([], () => r(require('@/page/personnel')), 'personnel');
const deparList = r => require.ensure([], () => r(require('@/page/deparList')), 'deparList');
const dg = r => require.ensure([], () => r(require('@/page/dg')), 'dg');
const rk = r => require.ensure([], () => r(require('@/page/rk')), 'rk');
const ck = r => require.ensure([], () => r(require('@/page/ck')), 'ck');
// 劳动合同
const labor = r => require.ensure([], () => r(require('@/page/labor')), 'labor');
//社保卡
const socialCard = r => require.ensure([], () => r(require('@/page/socialCard')), 'socialCard');

const routes = [{
        path: '/',
        component: login,
    },
    {
        path: '/manage',
        component: manage,
        redirect:"/home",
        name: '',
        children: [{
                path: '/home',
                component: home
            }, {
                path: '/addShop',
                component: addShop
            }, {
                path: '/addGoods',
                component: addGoods,
                meta: ['添加数据', '添加商品']
            }, {
                path: '/userList',
                component: userList,
                meta: ['数据管理', '用户列表']
            }, {
                path: '/shopList',
                component: shopList,
                meta: ['数据管理', '商家列表']
            }, {
                path: '/foodList',
                component: foodList,
                meta: ['数据管理', '食品列表']
            }, {
                path: '/orderList',
                component: orderList,
                meta: ['数据管理', '订单列表']
            }, {
                path: '/adminList',
                component: adminList,
                meta: ['数据管理', '管理员列表']
            }, {
                path: '/visitor',
                component: visitor,
                meta: ['图表', '用户分布']
            }, {
                path: '/newMember',
                component: newMember,
                meta: ['图表', '用户数据']
            }, {
                path: '/uploadImg',
                component: uploadImg,
                meta: ['文本编辑', 'MarkDown']
            }, {
                path: '/vueEdit',
                component: vueEdit,
                meta: ['编辑', '文本编辑']
            }, {
                path: '/adminSet',
                component: adminSet,
                meta: ['设置', '管理员设置']
            }, {
                path: '/sendMessage',
                component: sendMessage,
                meta: ['设置', '发送通知']
            }, {
                path: '/explain',
                component: explain,
                meta: ['说明', '说明']
            }, {
                path: '/post',
                component: post,
                meta: ['工资系统', '工资信息']
            },
            {
                path: '/personnel',
                component: personnel,
                meta: ['培训系统', '培训']
            },
            {
                path: '/train',
                component: train,
                meta: ['培训系统', '培训']
            }, {
                path: '/dialog',
                component: dialog,
                meta: ['培训系统', '学习详情']
            },
            {
                path: '/trainReport',
                component: trainReport,
                meta: ['培训系统', '培训列表']
            },
            {
                path: '/trainDetail:id',
                component: trainDetail,
                name: 'trainDetail',
                meta: ['培训系统', '培训列表详情']
            },
            {
                path: '/addTrains',
                component: addTrains,
                name: 'addTrains',
                meta: ['培训系统', '培训列表新增']
            },
            {
                path: '/deparList',
                component: deparList,
                name: 'deparList',
                meta: ['培训系统', '部门']
            },
            {
                path: '/dg',
                component: dg,
                name: 'dg',
                meta: ['进销存', '订购单']
            },
            {
                path: '/ck',
                component: ck,
                name: 'ck',
                meta: ['进销存', '出库单']
            },
            {
                path: '/rk',
                component: rk,
                name: 'rk',
                meta: ['进销存', '入库单']
            },
            {
                path: '/labor',
                component: labor,
                meta: ['工资系统', '劳动合同']
            },
            {
                path: '/socialCard',
                component: socialCard,
                meta: ['工资系统', '社保信息']
            }
        ]
    }
]

export default new Router({
    mode:'history',
    routes,
    strict: process.env.NODE_ENV !== 'production',
})
